package com.zhongxi.guoyuan.fragment.hmfragment;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.zhongxi.guoyuan.R;
import com.zhongxi.guoyuan.adapter.rewardCoin.DoubleMAdapter;
import com.zhongxi.guoyuan.base.BaseFragment;

import butterknife.Bind;
import butterknife.ButterKnife;

import static android.R.attr.dashGap;
import static android.R.attr.data;
import static android.R.attr.id;
import static android.R.attr.thickness;

/**
 * Created by Administrator on 2017/9/30.
 */

@SuppressLint("ValidFragment")
public class TwoMFragment extends BaseFragment {

    @Bind(R.id.tabLayout)
    TabLayout tabLayout;
    @Bind(R.id.viewPager)
    ViewPager viewPager;

    private DoubleMAdapter adapter;

    public TwoMFragment() {
        super();
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_title_cate, container, false);
        ButterKnife.bind(this, view);
        return view;
    }

    @SuppressLint("NewApi")
    @Override
    protected void initView() {
        super.initView();
        adapter = new DoubleMAdapter(getChildFragmentManager());
        viewPager.setAdapter(adapter);
        tabLayout.setupWithViewPager(viewPager);
//        adapter.setItemPrimary(id, trim);
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }

    public void setPrimary(String id, String trim) {
        if (adapter != null) {
            adapter.setItemPrimary(id, trim);
            adapter.notifyDataSetChanged();
        }
    }

    public void cleanList() {}
}
